package com.retallife.user.controller;


import com.retallife.user.exception.Result;
import com.retallife.user.pojo.Goods.GoodsVo;
import com.retallife.user.pojo.Video.VideoVo;
import com.retallife.user.service.Goods.GoodsService;
import com.retallife.user.service.Video.VideoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@Api(tags = "晒物信息类")
@RequestMapping(method = {RequestMethod.POST, RequestMethod.GET})
public class VideoController {

    @Autowired
    VideoService videoService;

    @ApiOperation(value = "查询晒物表的所有信息")
    @RequestMapping("FinaAllVideo")
    public List<VideoVo> FinaAllVideo() {
        return videoService.FinaAllVideo();
    }

    @ApiOperation(value = "查询某个用户的晒物")
    @RequestMapping("FinaVideo")
    public List<VideoVo> FinaVideo(@RequestParam String userName) {
        return videoService.FindVideo(userName);
    }

    @ApiOperation(value = "用户删除某个的晒物")
    @RequestMapping("DeleteVideo")
    public Result DeleteVideo(@RequestParam String userVideoName) {
        int result = videoService.DeleteVideo(userVideoName);
        if(result > 0){
            return Result.ok("删除成功");
        }
        return Result.ok("删除失败");
    }
}
